<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/25 0025
 * Time: 下午 3:24
 */
    header("Access-Control-Allow-Origin:*");
    //创建连接参数
    if(!empty($_POST) && $_POST["userTel"]!="" && $_POST["userPwd"]!=""){
        $serverIp = "127.0.0.1";
        $serverName = "root";
        $serverPwd = "";
        $serverdbName = "dbreg1704";
        //创建数据库连接
        $conn = new mysqli($serverIp,$serverName,$serverPwd,$serverdbName);
        //判断是否连接诶
        //$conn->connect_error;
        //sql指令
        $sql = "SELECT uname FROM userinfo WHERE utel='".$_POST['userTel']."' AND upwd = '".$_POST['userPwd']."'";

        $result = $conn->query($sql);

        if($result->num_rows==1){
            while($row = $result->fetch_assoc()){
                $arr = array("status"=>1,"msg"=>"成功","data"=>$row);
                print_r(json_encode($arr));
            }


        }else{
            $arr = array("status"=>0,"msg"=>"用户或密码错误");
            print_r(json_encode($arr));
        }
    }else{
        $arr = array("status"=>0,"msg"=>"逗我吗，啥都不填");
        print_r(json_encode($arr));
    }
